//
// Created by 19693 on 2023/11/28.
//

#ifndef MPU6050_ANALYSE_CJSON_H
#define MPU6050_ANALYSE_CJSON_H

#include "cJSON.h"
#include "stdlib.h"

typedef struct{
    int channel;
    int addr;
    int rate;
    int rst;
    int data;

}i2c_transport_config;


typedef struct{
    int addr;
    int data_length;
}addr_length;


typedef struct {
    addr_length send;
    addr_length listen;
}i2c_device_data;


typedef struct{
    int channel;
    int d_addr;
    i2c_device_data work_data[10];  // 目前最大长度为 10
    int s_delay;
    int w_delay;

}i2c_scan_config;

void add_i2c_device_config(cJSON* json,i2c_transport_config *i2c_device_config);

void recive_i2c_device_config(cJSON* json, i2c_scan_config *i2c_device_config);


#endif //MPU6050_ANALYSE_CJSON_H
